import {
  Get,
  Controller,
  UseGuards,
  Post,
  Body,
  Param,
  Query,
} from '@nestjs/common';
import { CallerService } from './caller.service';
import { Roles } from '../../auth/roles.decorator';
import { RolesGuard } from '../../auth/roles.guard';
import { PgaeDto } from './caller.dto';
// import {CreateGoodsDto,findBossAllDto,putExamineDto,findAllLimitDto,findByIdDto,putInfoDto,removeByIdDto} from './goods.dto'

@Controller('caller')
export class CallerController {
  constructor(private readonly callerService: CallerService) {}

  @Roles('admin')
  @UseGuards(RolesGuard)
  @Post('create')
  create(@Body() param) {
    return this.callerService.created(param);
  }

  @Roles('admin')
  @UseGuards(RolesGuard)
  @Post('put/:id')
  put(@Param('id') id: string, @Body() param) {
    return this.callerService.put(Number(id), param);
  }

  @Roles('admin')
  @UseGuards(RolesGuard)
  @Post('delete')
  delete(@Body() param) {
    return this.callerService.delete(param.id);
  }

  @Roles('admin')
  @UseGuards(RolesGuard)
  @Get('getList')
  getList(@Query() query: PgaeDto) {
    return this.callerService.getList(query);
  }
}
